[GLOBAL set_mode_not]
set_mode_not:
	push dx
	mov dx, 3DAh 
	in al,dx  ; Сбрасываем Flip-Flop

	mov dx, 3C0h
	mov al,10h  ; 10h доступ к атрибутам
	out dx,al    

	mov dx, 3C1h   ; регистр для чтения
	in al,dx
	and al, 11110111b
	push ax

	mov dx, 3DAh 
	in al,dx  ; Сбрасываем Flip-Flop
	mov dx, 3C0h
	mov al,10h  
	out dx,al
	pop ax
	mov dx, 3C0h ; регистр на запись совпадает с индексным регистром 
	out dx,al
	pop dx
ret

ATC_INDEX		equ		03C0h
crtc_addr		dw		3D4h               ; I/O address of CRTC (3D4h or 3B4h)

;----------------------------------------------------------------------
;       GetIndexRegister - Read the value of an indexed register
;
;       Entry:  DX = I/O port
;               AL = Index to read
;       Exit:   AH = Data read
;
;       DX and AL are preserved
;----------------------------------------------------------------------

[GLOBAL GetIndexRegister]
GetIndexRegister:
        out     dx,al
        mov     ah,al
        inc     dx
        in      al,dx
        dec     dx
        xchg    al,ah
        ret

;       Subfunction 003h:
;       ToggleIntensityBlinkBit - Set the intensity or blinking bit in the ATC mode register
;
;       Entry:  DS = Seg0
;               BL = Toggle state:
;                 0: Enable intensity
;                 1: Enable blinking
;       Exit:   None
;
[GLOBAL ToggleIntensityBlinkBit]
ToggleIntensityBlinkBit:
        push    dx
        mov     dx,[crtc_addr]
        add     dl,6
        cli            
        in  al,dx
        push bx
       	mov bl, ATC_INDEX
       	and bl, 0ffh
        mov     dl,bl
        pop bx
        mov     al,030h
        call    GetIndexRegister        ; This leaves ATC in data state
        mov     al,bl
        and     al,1
        shl     al,3
        and     ah,0F7h
        or      al,ah
        out     dx,al
        mov     al,20h
        out     dx,al
        sti
        pop     dx
        ret
